import request from '@/utils/request'

// 公开接口
/**
 * 获取院校列表
 */
export const getSchools = (params) => {
  return request({
    url: '/schools',
    method: 'get',
    params
  })
}

/**
 * 获取院校详情
 */
export const getSchoolDetail = (id) => {
  return request({
    url: `/schools/${id}`,
    method: 'get'
  })
}

/**
 * 获取院校Logo列表
 */
export const getSchoolLogos = () => {
  return request({
    url: '/schools/logos',
    method: 'get'
  })
}

// 管理员接口
/**
 * 获取院校列表（管理）
 */
export const getSchoolList = (params) => {
  return request({
    url: '/admin/schools',
    method: 'get',
    params
  })
}

/**
 * 创建院校
 */
export const createSchool = (data) => {
  return request({
    url: '/admin/schools',
    method: 'post',
    data
  })
}

/**
 * 更新院校
 */
export const updateSchool = (data) => {
  return request({
    url: `/admin/schools/${data.id}`,
    method: 'put',
    data
  })
}

/**
 * 删除院校
 */
export const deleteSchool = (id) => {
  return request({
    url: `/admin/schools/${id}`,
    method: 'delete'
  })
}